package hyl.base.flow.chart;

import hyl.base.kv.cache.KvCacheST;
import hyl.core.MyFun;


/**
 * 可持久化工单对象,需要耗时长的工单 需要保存中间状态,我们使用kvcache 来缓存
 * <p>
 * className: CWorkOrd
 * </p>
 * <p>
 * Description: 工单对象
 * </p>
 * 
 * @author: 37798
 * @date: 2021年12月7日 上午11:26:10
 * @copyright: 2018 da you zou Inc. All rights reserved.
 */
public class CWorkOrdDb extends AAttribute implements IWorkOrd {

	public static final int D_纳秒编号 = 1;
	public static final int D_UUID编号 = 2;
	public static final int 缓存 = 1024*1024*64;
	/**
	 * 默认
	 * 
	 * @param 编号类型
	 */
	public CWorkOrdDb(int 编号类型) {
		if (编号类型 == D_纳秒编号)
			id = MyFun.getNsDesc();
		else if (编号类型 == D_纳秒编号)
			id = MyFun.getUUID();
		_props =new KvCacheST<Object>("./kv/flow/chart","WO"+id,缓存);
	}

	public CWorkOrdDb() {
		id = MyFun.getNsDesc();
		_props = new KvCacheST<Object>("./kv/flow/chart","WO"+id,缓存);
	}

	public void closeDb() {
		_props.clear();
	}
	public String toJsonString() {	
		return MyFun.toJson(((KvCacheST<Object>)_props).toMap());
	}
	
}
